#include "geese.h"
#include "BlocksMatrix.h"
//con ngong
geese::geese(CBlocksMatrix* pParent) : CTetrad(pParent,vat_conngan)
{
}

geese::~geese()
{
}

bool geese::Rotate()
{
	bool bSuccess = false;
			bSuccess = true;
	return bSuccess;
}

bool geese::MoveLeft()
{
	bool bSuccess = false;
			m_iXPos--;
			bSuccess = true;
	return bSuccess;
}

bool geese::MoveRight()
{
	bool bSuccess = false;
			m_iXPos++;
			bSuccess = true;
	return bSuccess;
}

bool geese::MoveDown()
{
	return 0;
}

void geese::Draw()
{
	int screenX=0, screenY=0; 
		m_pParentMatrix->GetScreenPosFromCell(m_iXPos,m_iYPos,screenX,screenY);
		m_pBlockImg->BlitImage(screenX,screenY);
}

void geese::DrawOnScreen(const TRectanglei& rect)
{
	int XPos = (rect.GetWidth() - 2*BLOCK_WIDTH)/2 + rect.m_Left;
	int YPos = (rect.GetHeight() - 2*BLOCK_HEIGHT)/2 + rect.m_Top;
	m_pBlockImg->BlitImage(XPos,YPos);
}

void geese::FillMatrix()
{
	switch (m_Orientation)
	{
	case Rotation0:
	case Rotation180:
		m_pParentMatrix->FillCell(m_iXPos-1,m_iYPos,m_BlockColor);
		
		break;

	case Rotation90:
	case Rotation270:
		m_pParentMatrix->FillCell(m_iXPos,m_iYPos-1,m_BlockColor);
		break;
	}
}

bool geese::IsValid()
{
	bool bValid = false;
	if (m_pParentMatrix->IsCellFree(m_iXPos-1,m_iYPos) )
	{
		bValid = true;
	}

	return bValid;
}
